import Cookies from 'js-cookie'

export const TCAPPID = '2081599705'
export const whiteRouterList = ['/userInfo/index'] // no redirect whitelist

export const TokenKey = 'shopToken'
export const UserKey = 'userInfo'

export const EnterpriseList = 'enterpriseList'
export const SiteList = 'siteList'
export const CurrentEnterprise = 'currentEnterprise'
export const CurrentSite = 'currentSite'

export const mapKey = 'WfJR5vysHkMZYq4W64y32diDJPf0AcZi'

// 链接
export const linkReg = /^(https?:|mailto:|tel:)/

// 手机号
export const mobileReg = /^1[0-9]{10}$/

// 身份证
export const idCardReg = /(^\d{17}(\d|X|x)$)/

// 邮箱
export const emailReg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/

// 两位小数
export const towPointReg = /^(0|([1-9]\d*))(\.\d{1,2})?$/

// 正整数
export const integerNumberReg = /^[1-9]\d*$/

// todo 模拟接口返回菜单权限
export let menuList = [
  {
    path: '/enterProcess',
    title: '企业入驻',
    icon: 'icon-qiyeguanli',
    children: [
      {
        path: '/enterProcess/enter',
        title: '企业入驻'
      }
    ]
  },
  {
    path: '/shop',
    title: '店铺产品管理',
    icon: 'icon-dianpuguanli',
    children: [
      {
        path: '/shop/decoration',
        title: '店铺装修'
      }, {
        path: '/shop/creatProduct',
        title: '发布产品'
      }, {
        path: '/shop/product',
        title: '产品仓库'
      }, {
        path: '/shop/onSale',
        title: '在售产品'
      }, {
        path: '/shop/ticket',
        title: '套票'
      }
    ]
  },
  {
    path: '/marketing',
    title: '营销管理',
    icon: 'icon-yingxiaoguanli',
    children: [
      {
        path: '/marketing/coupon',
        title: '优惠券管理'
      },
      {
        path: '/marketing/activity',
        title: '活动管理'
      }
      // {
      //   path: '/marketing/seckill',
      //   title: '秒杀活动列表'
      // },
      // {
      //   path: '/marketing/seckillProduct',
      //   title: '秒杀产品记录'
      // }
    ]
  },
  {
    path: '/order',
    title: '订单管理',
    icon: 'icon-dingdanguanli',
    children: [
      {
        path: '/order/order',
        title: '订单列表'
      }
      // {
      //   path: '/order/settle',
      //   title: '结算管理'
      // },
      // {
      //   path: '/order/afterSale',
      //   title: '售后订单'
      // },
      // {
      //   path: '/order/consumeSettle',
      //   title: '消费金结算'
      // },
      // {
      //   path: '/order/cardSettle',
      //   title: '饭卡结算'
      // }
    ]
  },
  {
    path: '/system',
    title: '系统管理',
    icon: 'icon-xitongguanli',
    children: [
      {
        path: '/system/user',
        title: '员工管理'
      },
      {
        path: '/system/role',
        title: '角色管理'
      }
    ]
  }
]

// ToDo 临时权限控制
const currentSite = Cookies.getJSON(CurrentSite) || {}
if (currentSite.productType === 2) {
  console.log(22)
  menuList = [
    {
      path: '/enterProcess',
      title: '企业入驻',
      icon: 'icon-qiyeguanli',
      children: [
        {
          path: '/enterProcess/enter',
          title: '企业入驻'
        }
      ]
    }, {
      path: '/gas',
      title: '产品管理',
      icon: 'icon-dingdanguanli',
      children: [
        {
          path: '/gas/product',
          title: '产品管理'
        }
      ]
    }, {
      path: '/gas',
      title: '订单管理',
      icon: 'icon-dingdanguanli',
      children: [
        {
          path: '/gas/order',
          title: '订单列表'
        }
      ]
    }
  ]
}
